next up previous
Next: Hardware Cursors Up: Hardware for Window Previous: Graphics Context Switching

Fast and Arbitrary Window Clipping

In Figure 4 showing the per-fragment pipeline, the Pixel Ownership Test is where fragments are thrown away if they fall outside the window's drawable region. The drawable region of a window is often called the window's clip.

When the X server performs 2D X rendering, the X server can perform window clipping in software based on its special knowledge of every window's clip. But in GTX-RD and GT-XRD architectures, typically the hardware must enforce window clipping because the Pixel Ownership Test occurs late in the graphics pipeline. Also when using direct rendering, OpenGL programs do not generally have knowledge of their current window clip. In these cases, window clipping is typically supported in the hardware with the hardware clipping information updated by the X server as the window layout changes.

There are two common approaches to supporting window clipping in hardware:

Clip rectangles
define the window's clip as a limited number of rectangles (1 to 4 available clip rectangles is typical). Windows with simple clips, representable with the available number of available clip rectangles, can be clipped this way.

Clip ID planes
encode per-pixel state about the window to which a given frame buffer pixel belongs to. The hardware rendering state maintains a current clip ID value that can be compared with the clip value in the clip ID planes for every generated OpenGL fragment. When clip ID clipping is enabled, the fragment is rendered only if the current clip ID matches the pixel's clip value. Typically, 2 to 4 bits of clip ID planes are supported, providing 3 to 15 clip ID values.gif

Clip ID planes work for arbitrary clips,gif while clip rectangles work only for simple clips. Clip ID planes are generally slower than clip rectangles since every fragment clipped using clip ID planes must be tested against the pixel's clip ID that must be retrieved from frame buffer memory. Because the case of an unobscured window is the most important performance case and arbitrary clips must be supported, a hybrid approach combining both clip rectangles and clip ID planes is common. Figure 7 shows clip rectangles and clip ID planes used simultaneously.

The clip ID and clip rectangle hardware state must be maintained and updated as necessary by the X server when window clips change. Note that there are a limited number of clip ID values so the X server must be ready to virtualize clip ID usage if too many windows have complex clips that require clip IDs.



next up previous
Next: Hardware Cursors Up: Hardware for Window Previous: Graphics Context Switching



mjk@sgi.com